Improve xarray display of structural components for multivariate time series#555
Open
AlexAndorra wants to merge 5 commits intomainfrom
Open
Improve xarray display of structural components for multivariate time series#555AlexAndorra wants to merge 5 commits intomainfrom
xarray display of structural components for multivariate time series#555AlexAndorra wants to merge 5 commits intomainfrom
Conversation
Member
|
I need to think a bit about this. As a v0 I guess it's fine, but I have the feeling that the whole extract_components should be refactored to just do the right thing from jump. Probably it could make better use of arviz in the first place. For example here we're casting everything to numpy then working with that. Seems dumb? Some general comments:
|
Contributor
Author
|
Yep, I agree with that. We do need that patch for the Berlin tutorial, but that can be just that -- a patch. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #545
Currently
extract_components_from_idatareturns square brackets notations for thestatecoord, making it hard to select components when working with multivariate series. Things like:This PR adds a
restructureargument toextract_components_from_idata(defaultFalsefor backwards compatibility). WhenTrue, it will restructure thestatecoordinates as a multi-index for easier component selection, thus enabling selections likeidata.sel(component='level'),idata.sel(observed='gdp'), or evenidata.sel(component='level', observed='gdp').Again, this is especially useful for multivariate models with multiple observed states.
More precisely, the
statedimension is broken down into two new ones,componentandobserved, whose coordinates will be[('level', 'gdp'), ('trend', 'gdp'), ('ar', 'gdp')], [('level', 'unemployment'), ('trend', 'unemployment'), ('ar', 'unemployment')].This also allows each observed state to have arbitrary model structure inside, which the current multivariate setup allows.
NB: This PR is a first pass, and in no way exhaustive -- we probably need to expand to more complex cases, that users will surface up. But at least it gets the ball rolling and should be self-sufficient to already merge.